This way, we get a special no-copy case for resources.
https://bugzilla.gnome.org/show_bug.cgi?id=790270
const char *text)
{
GtkCssScanner *scanner;
- char *free_data = NULL;
+ GBytes *bytes;
if (text == NULL)
{
GError *load_error = NULL;
- if (g_file_load_contents (file, NULL,
- &free_data, NULL,
- NULL, &load_error))
+ bytes = g_file_load_bytes (file, NULL, NULL, &load_error);
+
+ if (bytes)
{
- text = free_data;
+ text = g_bytes_get_data (bytes, NULL);
}
else
{
}
}
}
+ else
+ {
+ bytes = NULL;
+ }
if (text)
{
gtk_css_provider_postprocess (css_provider);
}
- g_free (free_data);
+ if (bytes)
+ g_bytes_unref (bytes);
}
/**